//// Project name:JavaRedis
//// Creator:muhong
//// Date time:2022/11/25,10:49 下午
//// Name:SocketEventHandleTask
//
//package org.gmh.server;
//
//import java.nio.channels.SelectionKey;
//import java.util.concurrent.Callable;
//
//public class SocketEventTask implements Callable {
//
//    private SelectionKey key;
//
//    SocketEventTask(SelectionKey key) {
//        this.key = key;
//    }
//
//    @Override
//    public SocketEventTaskResult call() throws Exception {
//
//        OldNioSocketChannel oldNioSocketChannel = (OldNioSocketChannel) key.attachment();
//        int result = 0;
//        if (key.isReadable()) {
//            result = oldNioSocketChannel.doRead();
//        }
//        if (key.isWritable()) {
//            result = oldNioSocketChannel.doWrite();
//        }
//        return new SocketEventTaskResult(key, result);
//    }
//}
